home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / PC Card Manager / CIncludes / MachineExceptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-25  |  6.1 KB  |  215 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MachineExceptions.h
  3.  
  4.      Contains:    Processor Exception Handling Interfaces.
  5.  
  6.      Version:    System 7.5
  7.  
  8.      DRI:        Russell Williams
  9.  
  10.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Warning:    *** APPLE INTERNAL USE ONLY ***
  14.                  This file may contain unreleased API's
  15.  
  16.      BuildInfo:    Built by:            SuperMario Build Daemon
  17.                  With Interfacer:    2.0d10   (PowerPC native)
  18.                  From:                MachineExceptions.i
  19.                      Revision:        21
  20.                      Dated:            1/11/96
  21.                      Last change by:    JLR
  22.                      Last comment:    Changes for D11.
  23.  
  24.      Bugs:        Report bugs to Radar component “System Interfaces”, “Latest”
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __MACHINEEXCEPTIONS__
  29. #define __MACHINEEXCEPTIONS__
  30.  
  31. #ifndef __TYPES__
  32. #include <Types.h>
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT_SUPPORTED
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_ALIGN_SUPPORTED
  44. #pragma options align=power
  45. /* the following contents can only be used by compilers that support PowerPC struct alignment */
  46.  
  47. #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
  48. /* Some basic declarations used throughout the kernel */
  49. typedef struct OpaqueAreaID* AreaID;
  50. /* Machine Dependent types for PowerPC: */
  51. struct MachineInformationPowerPC {
  52.     UnsignedWide                     CTR;
  53.     UnsignedWide                     LR;
  54.     UnsignedWide                     PC;
  55.     unsigned long                     CR;
  56.     unsigned long                     XER;
  57.     unsigned long                     MSR;
  58.     unsigned long                     MQ;
  59.     unsigned long                     ExceptKind;
  60.     unsigned long                     DSISR;
  61.     UnsignedWide                     DAR;
  62.     UnsignedWide                     Reserved;
  63. };
  64. typedef struct MachineInformationPowerPC MachineInformationPowerPC;
  65.  
  66. struct RegisterInformationPowerPC {
  67.     UnsignedWide                     R0;
  68.     UnsignedWide                     R1;
  69.     UnsignedWide                     R2;
  70.     UnsignedWide                     R3;
  71.     UnsignedWide                     R4;
  72.     UnsignedWide                     R5;
  73.     UnsignedWide                     R6;
  74.     UnsignedWide                     R7;
  75.     UnsignedWide                     R8;
  76.     UnsignedWide                     R9;
  77.     UnsignedWide                     R10;
  78.     UnsignedWide                     R11;
  79.     UnsignedWide                     R12;
  80.     UnsignedWide                     R13;
  81.     UnsignedWide                     R14;
  82.     UnsignedWide                     R15;
  83.     UnsignedWide                     R16;
  84.     UnsignedWide                     R17;
  85.     UnsignedWide                     R18;
  86.     UnsignedWide                     R19;
  87.     UnsignedWide                     R20;
  88.     UnsignedWide                     R21;
  89.     UnsignedWide                     R22;
  90.     UnsignedWide                     R23;
  91.     UnsignedWide                     R24;
  92.     UnsignedWide                     R25;
  93.     UnsignedWide                     R26;
  94.     UnsignedWide                     R27;
  95.     UnsignedWide                     R28;
  96.     UnsignedWide                     R29;
  97.     UnsignedWide                     R30;
  98.     UnsignedWide                     R31;
  99. };
  100. typedef struct RegisterInformationPowerPC RegisterInformationPowerPC;
  101.  
  102. struct FPUInformationPowerPC {
  103.     UnsignedWide                     Registers[32];
  104.     unsigned long                     FPSCR;
  105.     unsigned long                     Reserved;
  106. };
  107. typedef struct FPUInformationPowerPC FPUInformationPowerPC;
  108.  
  109. /* Exception related declarations */
  110.  
  111. enum {
  112.     kWriteReference                = 0,
  113.     kReadReference                = 1,
  114.     kFetchReference                = 2,
  115.     writeReference                = kWriteReference,                /* Obsolete name*/
  116.     readReference                = kReadReference,                /* Obsolete name*/
  117.     fetchReference                = kFetchReference                /* Obsolete name*/
  118. };
  119.  
  120. typedef unsigned long MemoryReferenceKind;
  121. struct MemoryExceptionInformation {
  122.     AreaID                             theArea;
  123.     LogicalAddress                     theAddress;
  124.     OSStatus                         theError;
  125.     MemoryReferenceKind             theReference;
  126. };
  127. typedef struct MemoryExceptionInformation MemoryExceptionInformation;
  128.  
  129.  
  130. enum {
  131.     kUnknownException            = 0,
  132.     kIllegalInstructionException = 1,
  133.     kTrapException                = 2,
  134.     kAccessException            = 3,
  135.     kUnmappedMemoryException    = 4,
  136.     kExcludedMemoryException    = 5,
  137.     kReadOnlyMemoryException    = 6,
  138.     kUnresolvablePageFaultException = 7,
  139.     kPrivilegeViolationException = 8,
  140.     kTraceException                = 9,
  141.     kInstructionBreakpointException = 10,
  142.     kDataBreakpointException    = 11,
  143.     kIntegerException            = 12,
  144.     kFloatingPointException        = 13,
  145.     kStackOverflowException        = 14,
  146.     kTaskTerminationException    = 15,
  147.     kTaskCreationException        = 16
  148. };
  149.  
  150. #if OLDROUTINENAMES
  151.  
  152. enum {
  153.     unknownException            = kUnknownException,            /* Obsolete name*/
  154.     illegalInstructionException    = kIllegalInstructionException,    /* Obsolete name*/
  155.     trapException                = kTrapException,                /* Obsolete name*/
  156.     accessException                = kAccessException,                /* Obsolete name*/
  157.     unmappedMemoryException        = kUnmappedMemoryException,        /* Obsolete name*/
  158.     excludedMemoryException        = kExcludedMemoryException,        /* Obsolete name*/
  159.     readOnlyMemoryException        = kReadOnlyMemoryException,        /* Obsolete name*/
  160.     unresolvablePageFaultException = kUnresolvablePageFaultException, /* Obsolete name*/
  161.     privilegeViolationException    = kPrivilegeViolationException,    /* Obsolete name*/
  162.     traceException                = kTraceException,                /* Obsolete name*/
  163.     instructionBreakpointException = kInstructionBreakpointException, /* Obsolete name*/
  164.     dataBreakpointException        = kDataBreakpointException,        /* Obsolete name*/
  165.     integerException            = kIntegerException,            /* Obsolete name*/
  166.     floatingPointException        = kFloatingPointException,        /* Obsolete name*/
  167.     stackOverflowException        = kStackOverflowException,        /* Obsolete name*/
  168.     terminationException        = kTaskTerminationException,    /* Obsolete name*/
  169.     kTerminationException        = kTaskTerminationException        /* Obsolete name*/
  170. };
  171.  
  172. #endif
  173. typedef unsigned long ExceptionKind;
  174. union ExceptionInfo {
  175.     MemoryExceptionInformation *    memoryInfo;
  176. };
  177. typedef union ExceptionInfo ExceptionInfo;
  178.  
  179. struct ExceptionInformationPowerPC {
  180.     ExceptionKind                     theKind;
  181.     MachineInformationPowerPC *        machineState;
  182.     RegisterInformationPowerPC *    registerImage;
  183.     FPUInformationPowerPC *            FPUImage;
  184.     ExceptionInfo                     info;
  185. };
  186. typedef struct ExceptionInformationPowerPC ExceptionInformationPowerPC;
  187.  
  188. typedef ExceptionInformationPowerPC ExceptionInformation;
  189. typedef MachineInformationPowerPC MachineInformation;
  190. typedef RegisterInformationPowerPC RegisterInformation;
  191. typedef FPUInformationPowerPC FPUInformation;
  192. /*
  193.  Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  194.             It must be a PowerPC function pointer with NO routine descriptor. 
  195. */
  196. typedef OSStatus (*ExceptionHandler)(ExceptionInformationPowerPC *theException, void *refcon);
  197. /* Routine for installing per-process exception handlers */
  198. extern pascal ExceptionHandler InstallExceptionHandler(ExceptionHandler theHandler, void *refcon);
  199.  
  200. #endif
  201.  
  202. #pragma options align=reset
  203. #endif /* PRAGMA_ALIGN_SUPPORTED */
  204.  
  205. #if PRAGMA_IMPORT_SUPPORTED
  206. #pragma import off
  207. #endif
  208.  
  209. #ifdef __cplusplus
  210. }
  211. #endif
  212.  
  213. #endif /* __MACHINEEXCEPTIONS__ */
  214.  
  215.